/*
 * Created by SharpDevelop.
 * User: MyWife
 * Date: 10/1/2010
 * Time: 12:49 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using popLib;
using System.IO;

namespace TaskNoteManager
{
	/// <summary>
	/// Description of TaskTabPage.
	/// </summary>
	public class TaskTabPage: TabPage
	{
		TaskListGrid tasklist;
		public TaskTabPage(string file)
		{
			this.Text = Path.GetFileNameWithoutExtension(file);
			
			//add tasklistgrid
			tasklist = new TaskListGrid(file);
			tasklist.Dock = DockStyle.Fill;
			
			tasklist.NoteChangeEvent += delegate{
				this.Text = this.Text.Replace("*","")+"*";
			};
			
			this.Controls.Add( tasklist );
			
			//add Task information
			TaskTabInfo info = new TaskTabInfo();
			info.Dock = DockStyle.Bottom;
			this.Controls.Add(info);
		}
		
		public void SaveData(){
			tasklist.SaveData();
			this.Text = this.Text.Replace("*","");
		}
		
		public void LoadData(){
			tasklist.LoadData();
			this.Text = this.Text.Replace("*","");
		}
		
		public void Remove(){
			tasklist.Remove();			
		}
	}
}
